﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebHoiChoMuaBan.Controllers.Helpers;
using WebHoiChoMuaBan.Models;

namespace WebHoiChoMuaBan.Controllers.Private
{
    public class PrivateController : PublicController
    {
        [HttpPost]
        public ActionResult UpdateSologan(string txtSologan)
        {
            int? uid = null;
            if (Session["MemId"] != null)
                uid = (int)Session["MemId"];
            if (!this.IsLogin || uid == null)
                return HomePage();
            if (LoadMember(uid.Value) == null && txtSologan != null)
            {
                MemberHelper memHelper = new MemberHelper();
                Member mem = memHelper.getMember(uid.Value);
                mem.MemSlogan = txtSologan;
                memHelper.Save();
            }
            return HomePage();
        }
    }
}
